/*    */ package com.zimbra.cs.account.ldap.upgrade;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.Cos;
/*    */ import com.zimbra.cs.account.ldap.LdapProv;
/*    */ import com.zimbra.cs.ldap.LdapClient;
/*    */ import com.zimbra.cs.ldap.LdapServerType;
/*    */ import com.zimbra.cs.ldap.LdapUsage;
/*    */ import com.zimbra.cs.ldap.ZLdapContext;
/*    */ import java.util.HashMap;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class BUG_59720
/*    */   extends UpgradeOp
/*    */ {
/*    */   void doUpgrade()
/*    */     throws ServiceException
/*    */   {
/* 36 */     ZLdapContext zlc = LdapClient.getContext(LdapServerType.MASTER, LdapUsage.UPGRADE);
/*    */     try {
/* 38 */       doAllCos(zlc);
/*    */     } finally {
/* 40 */       LdapClient.closeContext(zlc);
/*    */     }
/*    */   }
/*    */   
/*    */   private void doEntry(ZLdapContext zlc, Cos cos) throws ServiceException
/*    */   {
/* 46 */     String attrName = "zimbraFilterSleepInterval";
/* 47 */     String oldValue = "100ms";
/* 48 */     String newValue = "1ms";
/*    */     
/* 50 */     String curVal = cos.getAttr(attrName);
/* 51 */     this.printer.print("Checking cos [" + cos.getName() + "]: " + "current value of " + attrName + " is " + curVal);
/*    */     
/* 53 */     if (newValue.equals(curVal)) {
/* 54 */       this.printer.println(" => not updating ");
/* 55 */       return;
/*    */     }
/*    */     
/* 58 */     Map<String, Object> attrValues = new HashMap();
/* 59 */     attrValues.put(attrName, newValue);
/*    */     try {
/* 61 */       this.printer.println(" => updating to " + newValue);
/* 62 */       modifyAttrs(zlc, cos, attrValues);
/*    */     }
/*    */     catch (ServiceException e) {
/* 65 */       this.printer.println("Caught ServiceException while modifying " + cos.getName());
/* 66 */       this.printer.printStackTrace(e);
/*    */     }
/*    */   }
/*    */   
/*    */   private void doAllCos(ZLdapContext zlc) throws ServiceException
/*    */   {
/* 72 */     List<Cos> coses = this.prov.getAllCos();
/*    */     
/* 74 */     for (Cos cos : coses) {
/* 75 */       String name = "cos " + cos.getName();
/* 76 */       doEntry(zlc, cos);
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/ldap/upgrade/BUG_59720.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */